import Layout from '@/layout/index.vue';
import { IconChart, IconHome, IconMenu } from '@/components/app-icons/index.js';

export const basicRoutes = [
  {
    name: '404',
    path: '/404',
    component: () => import('@/views/error-page/404.vue'),
    isHidden: true,
  },
  {
    name: 'REDIRECT',
    path: '/redirect',
    component: Layout,
    isHidden: true,
    children: [
      {
        name: 'REDIRECT_NAME',
        path: '',
        component: () => import('@/views/redirect/index.vue'),
      },
    ],
  },
  {
    name: 'LOGIN',
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    isHidden: true,
    meta: {
      title: '登录页',
    },
  },

  {
    name: 'Dashboard',
    path: '/',
    component: Layout,
    redirect: '/home',
    meta: {
      title: '首页',
      icon: IconChart,
    },
    children: [
      {
        name: 'Home',
        path: 'home',
        component: () => import('@/views/dashboard/index.vue'),
        meta: {
          title: '总览',
          icon: IconHome,
        },
      },
    ],
  },
  {
    name: 'CustomerChat',
    path: '/customer-chat',
    component: () => import('@/views/extend/customer-chat/index.vue'),
    isHidden: true,
    meta: {
      title: '在线客服',
    },
  },
];

export const NOT_FOUND_ROUTE = {
  name: 'NotFound',
  path: '/:pathMatch(.*)*',
  redirect: '/404',
  isHidden: true,
};

const modules = import.meta.glob('./modules/*.js', { eager: true });
const asyncRoutes = [];
Object.keys(modules).forEach((key) => {
  asyncRoutes.push(...modules[key].default);
});
export { asyncRoutes };
